<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%-- 引入页面头 --%>
<%@ include file="/pageHead.jsp"%>

<form name="form1" id="form1" action="" method="post">
	<div class="pageMain">
		<div class="pageTitle">
			<%=MessageResourcesUtils.getMessage(request, "systemmanage.bascsetting.title")%>
			<span></span>
			<%=MessageResourcesUtils.getMessage(request, "systemmanage.parameter.title1") %>
			<span></span>
			<%=MessageResourcesUtils.getMessage(request, "systemmanage.parameter.title.add") %>
		</div>
		<div class="pageBody">
			<div class="form-group">
				<ul> 
					<li>
						<i>*</i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.parameter.column.code")%></label>
						<span>
							<input type="text" id="code" name="code" class="validate[required]"/>
						</span>
					</li>
					<li>
						<i>*</i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.parameter.column.name")%></label>
						<span>
							<input type="text" id="name" name="name" class="validate[required]"/>
						</span>
					</li>				
				</ul>
				<ul> 
					<li>
						<i>*</i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.parameter.column.type")%></label>
						<span>
							<select name="type" id="type" onchange="changeList()"></select>
						</span>
					</li>
					<li>
						<i>*</i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.parameter.label.selectvaluelist")%></label>
						<span>
							<input type="text" id="selectvaluelist" name="selectvaluelist"/>
						</span>
					</li>				
				</ul>
				<ul> 
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.parameter.column.description")%></label>
						<span>
							<input type="text" id="description" name="description"/>
							<!-- <textarea rows="" cols="" class="validate[maxSize[900]]" id="description" name="description"></textarea> -->
						</span>
					</li>			
				</ul>
				
			</div>		
        	<div class="button-group">
       			<input type="button" class="btn btn-default"  id="butSave" name="butSave" value='<%=MessageResourcesUtils.getMessage(request, "common.button.save") %>' />
       			<input type="button" class="btn btn-default"  id="butReturn" name="butReturn" value='<%=MessageResourcesUtils.getMessage(request, "common.button.back") %>' />
			</div>
		</div>
	</div>
</form>

<script type="text/javascript">	
$(document).ready(function() {
	$("#type").selectutil({
		optModel : <%=SysConstant.ParameterType.getModelJSONString(false,false)%>,
		optDefault : <%=SysConstant.ParameterType.SELECT%>
	});
	$('#butSave').click(function() {
		var exp = $('#form1').validationEngine('validate');

		if(exp==true)
		{
			// 显示进度条
			showSending();
			$.ajax({
				type: 'POST',
			    url: '${systemctx}/systemmanage/parameter/validationParameter.json',
			    data: $("#form1").serialize(),
			    dataType: 'json',
			    success: function(data)
			    {
			    	//关闭执行...
					closeSending();
			    	if (data.messagetype == '2')
			    	{
			    		//显示AJAX请求后的提示信息
						$.fn.ajaxmessage(data);
			    	}
			    	else
			    	{
			    		form1.action="${systemctx}/systemmanage/parameter/addParameter.web";
						form1.submit();
			    	}
			    }
			});
		}
	});
	
	$('#butReturn').click(function(){
		parent.document.location.reload();
	    $.fn.closeIssWindow();
	});
});

function changeList(){
 	var type=$('#type').val();
 	var selectValue=document.getElementById('selectvaluelist');
 	if(type > 0){
 		selectValue.value ="";
 		selectValue.disabled  = "disabled";
 	}else{
 		selectValue.removeAttribute('disabled');
 	}
};
</script>
<%-- 引入页面尾 --%>
<%@ include file="/pageFloor.jsp"%>